package Servlets;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Clases.Cuota;
import Clases.Residente;

/**
 * Servlet implementation class CreaResidentes
 */
@WebServlet("/CreaResidentes")
public class CreaResidentes extends HttpServlet {
	private static final long serialVersionUID = 1L;
	 ArrayList<Residente> listaResidentes = new ArrayList<Residente>();  
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public CreaResidentes() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		

		String nom = request.getParameter("nombre");
		String ap = request.getParameter("paterno");
		String am = request.getParameter("materno");
		String dni = request.getParameter("dni");


		Residente objResidente = new Residente();
		objResidente.setNombre(nom);
		objResidente.setPaterno(ap);
		objResidente.setMaterno(am);
		objResidente.setDni(dni);
		
		listaResidentes.add(objResidente);

		request.setAttribute("listaR",listaResidentes);
		RequestDispatcher rd = request.getRequestDispatcher("MantResisdente.jsp");
	    rd.forward(request, response);
	}

}
